package com.mihuo;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.PostConstruct;

@Slf4j
@EnableCaching // 启用缓存
@EnableAsync //启用异步
@EnableScheduling //启用定时任务
@SpringBootApplication
public class SpringWebApp {

    public static void main(String[] args) {
        Environment env = SpringApplication.run(SpringWebApp.class, args).getEnvironment();
        String path = env.getProperty("server.servlet.context-path") == null ? "" : env.getProperty("server.servlet.context-path");
        String port = env.getProperty("server.port");
        log.info("SpringWebApp started. doc html: http://localhost:{}{}/doc.html", port, path);
        log.info("quartz admin url: http://localhost:{}/static/sys/quartz.html", port);
    }

}
